<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>js</title>
</head>
<body>
	<h1>linux</h1>
	<p>linux is very much! linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!</p>

	<h1>linux</h1>
	<p>linux is very much! linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!</p>
	<h1>linux</h1>
	<p>linux is very much! linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!</p>
	<h1>linux</h1>
	<p>linux is very much! linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!</p>
	
</body>

<script>
	
	objs=document.getElementsByTagName('h1');
	ps=document.getElementsByTagName('p');
	for(i=0; i<objs.length;i++){

		objs[i].setAttribute('line',i);//行号不同。 根据行号，找到邻近的p标签

		objs[i].setAttribute('num',0);
		ps[i].id=i;


		objs[i].onclick=function(){
			num=parseInt(this.getAttribute('num'));
			line=this.getAttribute('line');//获得点击的line
			np=document.getElementById(line);
			if(num%2==0){
				//下边的p标签隐藏
				np.style.display='none';
			}else{
				//下边的p标签显示
				np.style.display='block';
			}
			this.setAttribute('num',parseInt(num)+1); 	
		}
	}

</script>
</html>